﻿<?php //Seyret Component v.0.3//
/**
* @package Seyret
* @version 0.3
* @copyright Copyright (C) 2008 Mustafa DINDAR. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* Seyret Video Component is a free software.
* See seyrettos.html for license notices and details.
*/

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );



$session =& JFactory::getSession();
$seyretmessagetype=$session->get('seyret.messagetype');
$seyretmessage=$this->seyretmessage($seyretmessagetype);
$session->clear('seyret.messagetype');


$video=$this->videoData;
$relatedvideolist=$this->relatedvideos;
$user =& JFactory::getUser();

$nohtml = JRequest::getVar('format');



?><?php if ($nohtml != "raw") echo  "<div id=\"relatedvideosbox_js\" style=\"display:".$this->relatedvideosdisplay.";\">" ;?><div id="relatedvideostitle">
				<?php echo JText::_('Related Videos');?>
			</div>			
			
			<div id="relatedvideosbuttons">
				<div id="rvdisplayswitcher">
					<?php
		
						//create switch button here
						if ($this->rvdisplay=="oc") {
						?>
						<a href="<?php echo $this->absURL("index.php?option=com_seyret&view=video&id=".$video->id."&rvds=multi");?>">
							<img src="<?php echo JURI::root()."components/com_seyret/themes/default/images/switchmulti.png";?>" alt="" />
						</a>
						
						<?php
						
						} else {
						?>
						<a href="<?php echo $this->absURL("index.php?option=com_seyret&view=video&id=".$video->id."&rvds=oc");?>">
							<img src="<?php echo JURI::root()."components/com_seyret/themes/default/images/switchoc.png";?>" alt="" />
						</a>
						
						<?php							
						}
					
					?>

				</div>
				<div style="clear:both;"></div>
			</div>

			<div id="relatedvideoslist">
				<?php 

	
					//generate one column view
					if ($this->rvdisplay == "oc") {
						foreach ($relatedvideolist as $relatedvideolist) {
							$safevideotitle = str_replace("'", "\'", $relatedvideolist->videotitle);
							$safevideotitle = str_replace("\"", "&quot;", $safevideotitle);						
							$playlistenabled=false;
							if ($this->registry->getValue('seyret.vsplugins.'.str_replace(".", "", $relatedvideolist->videoservertype))=="1") $playlistenabled=true;
												
							if ($relatedvideolist->id==$video->id) continue; 
							
							$inql = false;
							if (in_array($relatedvideolist->id, $this->quicklistarray)) {
								$inql = true;			
							}


							?>
						



							<div class="relatedvideoslistrow">
							
								<div class="videothumbscvdiv">
									<a href="<?php echo $relatedvideolist->videolink ; ?>" class="videolink"  rel="mustafa">
										<img class="videothumbscv" src="<?php echo htmlentities($relatedvideolist->videothumbnail);?>" alt="" />
									</a>
									<div id="rvaddtoqlbdiv<?php echo $relatedvideolist->id; ?>" style="margin-top:-27px; padding-left:7px; z-index:9999;">
										<img id="rvaddtoqlimg_js_<?php echo $relatedvideolist->id; ?>" class="addtoquicklistbutton" src="<?php echo JURI::root()."components/com_seyret/themes/default/images/add_ql.png";?>" alt="" onclick="jQuery.seyrettools.addtoquicklist('<?php echo $relatedvideolist->id; ?>', '<?php echo htmlentities($relatedvideolist->videothumbnail);?>', '<?php echo $safevideotitle; ?>', '<?php echo $relatedvideolist->videonojxlink; ?>')" style="visibility:<?php echo ($inql==false&&$playlistenabled==true) ? 'visible' : 'hidden';?>;"/>
										<img id="rvaddtoqlimg_js_rem<?php echo $relatedvideolist->id; ?>" src="<?php echo JURI::root()."components/com_seyret/themes/default/images/added_ql.png";?>" alt="" style="visibility:<?php echo $inql==false ? 'hidden' : 'visible';?>; margin-left:-16px;"/>
									</div>
									
									<div class="watchpagelistdurationdivmc"><?php echo $relatedvideolist->duration;?>
									</div>
										
										
								</div>
								
								<div style="float:left;">
										<div class="watchpagelistvideotitlediv">
											<a href="<?php echo $relatedvideolist->videolink; ?>" class="videolink">
											<?php echo $relatedvideolist->videotitle; ?>
											</a>
										</div>

										
										<div class="watchpagelistownerdiv">
											<?php echo JText::_('Owner').": ";?><a href="<?php echo $this->absURL("index.php?option=com_seyret&view=user&id=".$relatedvideolist->addedby); ?>" class="editbuttonlink"><?php echo $relatedvideolist->username; ?></a>
										</div>
										
										<div  class="watchpagelistviewsdiv">
											<?php echo JText::_('Views').": ".$relatedvideolist->hits; ?>
										</div>		

										<div  class="watchpagelistaddeddatediv">
											<?php echo JText::_('Date').": ".$relatedvideolist->addeddate; ?>
										</div>									
								</div>
							
							
							</div>
							
							<div style="clear:both;"></div>
							
							
							<?php
						}						
					} else {
					//generate multicolumn view
					
						$rvcolumn=1;
						foreach ($relatedvideolist as $relatedvideolist) {
							$safevideotitle = str_replace("'", "\'", $relatedvideolist->videotitle);
							$safevideotitle = str_replace("\"", "&quot;", $safevideotitle);	
							
							$playlistenabled=false;
							if ($this->registry->getValue('seyret.vsplugins.'.str_replace(".", "", $relatedvideolist->videoservertype))=="1") $playlistenabled=true;						
							if ($relatedvideolist->id==$video->id) continue; 
							$inql = false;
							if (in_array($relatedvideolist->id, $this->quicklistarray)) {
								$inql = true;			
							}

						
						?>
							<div class="scvvideomulticblock">
							
								<div class="videothumbscvdiv">
									<a href="<?php echo $relatedvideolist->videolink ; ?>" class="videolink">
										<img class="videothumbscv" src="<?php echo htmlentities($relatedvideolist->videothumbnail);?>" alt="" />
									</a>
									<div id="scaddtoqlbdiv<?php echo $relatedvideolist->id; ?>" style="margin-top:-27px; padding-left:7px; z-index:9999;">
										<img id="rvaddtoqlimg_js_<?php echo $relatedvideolist->id; ?>" class="addtoquicklistbutton" src="<?php echo JURI::root()."components/com_seyret/themes/default/images/add_ql.png";?>" alt="" onclick="jQuery.seyrettools.addtoquicklist('<?php echo $relatedvideolist->id; ?>', '<?php echo htmlentities($relatedvideolist->videothumbnail);?>', '<?php echo $safevideotitle; ?>', '<?php echo $relatedvideolist->videonojxlink; ?>')" style="visibility:<?php echo ($inql==false&&$playlistenabled==true) ? 'visible' : 'hidden';?>;"/>
										<img id="rvaddtoqlimg_js_rem<?php echo $relatedvideolist->id; ?>" src="<?php echo JURI::root()."components/com_seyret/themes/default/images/added_ql.png";?>" alt="" style="visibility:<?php echo $inql==false ? 'hidden' : 'visible';?>; margin-left:-16px;"/>
									</div>
									
									<div class="watchpagelistdurationdivmc"><?php echo $relatedvideolist->duration;?>
									</div>
									
								</div>
								<div style="clear:both;"></div>
								
								<div>
									<div class="videotitlescvmulti">
										<a href="<?php echo $relatedvideolist->videolink ; ?>"  class="videolink">
										<?php echo $relatedvideolist->videotitle; ?>
										</a>
									</div>
								
								</div>				
							
							
							</div>
							
												
						
						
						<?php
						
						$rvcolumn++;
						if ($rvcolumn>3) {
							echo "<div style=\"clear:both;\"></div>	";
							$rvcolumn=1;
						}
						
						}
					
					
					} ?>						
			</div>
			
			<?php if ($nohtml != "raw") echo  "</div>" ;?>
			
			<!-- END: Related Videos -->
			
